#include <bits/stdc++.h>

using namespace std;

class Solution {
   public:
    vector<string> splitWordsBySeparator(vector<string>& words, char separator) {
        vector<string> ret;
        for (auto& word : words) {
            auto l = word.begin(), r = word.begin();
            while (r != word.end()) {
                while (r != word.end() && *r != separator) {
                    r++;
                }
                if (l != r) {
                    ret.push_back(string(l, r));
                }
                if (r != word.end()) {
                    r++;
                    l = r;
                }
            }
        }
        return ret;
    }
};